import type { postOrPutType } from "@/constants";
import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.js";
/* 分配运营商地址 */
const url = "/admin/merchant/investor-allocate-rule";
/* 获取投资商分配列表 */
export const getInvestorAllocateRuleList = <T, D>(params?: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 获取投资商分配详情信息 */
export const getInvestorAllocateRuleByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 新增修改投资商分配 */
export const commonInvestorAllocateRuleInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 删除投资商分配 */
export const deleteInvestorAllocateRuleInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
